﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dot5Demo.MarkDowngm
{
    public class MDHeader : MDElement
    {
        public HeaderLevel Level { get; set; }
        public Alignment Alignment { get; set; }
        public const string AlignmentTemplate = "<p align=\"{0}\">{1}</p>";
        public override string GetContentString()
        {
            var str = base.GetContentString();
            switch (Alignment)
            {
                case Alignment.Center:
                    str = string.Format(AlignmentTemplate, "center", str);
                    break;
                case Alignment.Right:
                    str = string.Format(AlignmentTemplate, "right", str);
                    break;
                case Alignment.Left:
                default:
                    break;
            }
            switch (Level)
            {
                case HeaderLevel.H1:
                    str = "# " + str;
                    break;
                case HeaderLevel.H2:
                    str = "## " + str;
                    break;
                case HeaderLevel.H3:
                    str = "### " + str;
                    break;
                case HeaderLevel.H4:
                    str = "#### " + str;
                    break;
                case HeaderLevel.H5:
                    str = "#### " + str;
                    break;
                case HeaderLevel.H6:
                    str = "##### " + str;
                    break;
                default:
                    break;
            }
            return str;
        }
    }

    public enum HeaderLevel
    {
        H1=1,
        H2=2,
        H3=3,
        H4=4,
        H5=5,
        H6=6,
    }

}
